package com.ddwl.wallet.dao.model;


import com.ddwl.common.dao.model.BaseModel;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Table;
import java.math.BigDecimal;

@Getter
@Setter
@Table(name = "sys_user_wallet")
public class UserWallet extends BaseModel {



    /**
     * 用户ID
     */
    private String userId;
    /**
     * 用户名称
     */
    private String userName;
    /**
     * 总金额
     */
    private BigDecimal totalAmount;
    /**
     *冻结金额
     */
    private BigDecimal frozenAmount;
    /**
     * 可用金额
     */
    private BigDecimal availableAmount;

    public static UserWallet createUserWallet(String userId){
        UserWallet userWallet = new UserWallet();
        userWallet.setUserId(userId);
        userWallet.setAvailableAmount(BigDecimal.ZERO);
        userWallet.setFrozenAmount(BigDecimal.ZERO);
        userWallet.setTotalAmount(BigDecimal.ZERO);
        return userWallet;
    }

}
